package com.ys.erp.entity.data.bean;

import com.baomidou.mybatisplus.annotation.*;
import lombok.AllArgsConstructor;
import lombok.Data;
import lombok.Getter;

import java.time.LocalDateTime;
import java.util.HashMap;
import java.util.Map;

/**
 * @author lwj
 * @date 2023/7/14
 */

@Data
@TableName(value = "t_user_coupon")
public class UserCoupon {
    /**
     * 主键
     */
    @TableId(value = "id", type = IdType.AUTO)
    private Long id;

    /**
     * 用户id
     */
    @TableField(value = "user_id")
    private Long userId;

    /**
     * 券id
     */
    @TableField(value = "coupon_id")
    private Long couponId;

    /**
     * 获取时间
     */
    @TableField(value = "get_time")
    private LocalDateTime getTime;

    /**
     * 有效起始时间
     */
    @TableField(value = "valid_start_time")
    private LocalDateTime validStartTime;

    /**
     * 有效结束时间
     */
    @TableField(value = "valid_end_time")
    private LocalDateTime validEndTime;


    /**
     * 0未使用，1已使用，2已过期
     */
    @TableField(value = "coupon_status")
    private Integer couponStatus;

    /**
     * 已使用订单id
     */
    @TableField(value = "order_id")
    private Long orderId;

    @TableField(value = "emp_id")
    private Long empId;

    @TableField(value = "emp_name")
    private String empName;

    @TableField(value = "source_type")
    private String sourceType;

    @TableField(value = "source_id")
    private Long sourceId;


    @TableField(value = "version")
    @Version
    private Integer version;

    @TableField(value = "create_time")
    private LocalDateTime createTime;

    @TableField(value = "update_time", update = "now()")
    private LocalDateTime updateTime;


    @AllArgsConstructor
    @Getter
    public enum Enums {

        ACTIVITY_COUPON, SYSTEM_COUPON

    }

    public static final Map<String, String> ENUM_MAP = new HashMap<>();

    static {
        ENUM_MAP.put(Enums.ACTIVITY_COUPON.toString(), "活动领取");
        ENUM_MAP.put(Enums.SYSTEM_COUPON.toString(), "系统发放");
    }
}